#!/bin/bash

#任何命令执行出错既退出
set -e

shell_path="$( cd "$( dirname "$0"  )" && pwd  )"

if [ $# -ne 2 ]; then
  echo "Usage 1: rsa_private_key.pem file-path"
  echo "Usage 2: getmobileuuid the-mobileprovision-file-path"
  exit 1
fi

privatekeypath=$1
infilepath=$2
filename=${infilepath##*/}

openssl rsautl -sign -inkey $privatekeypath -in $infilepath -out ${filename}.bak

echo "enc file path: "${shell_path/${filename}.bak}""

#退出命令执行出错既退出模式
set +e
